<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
name=name :
<input type="text" name="name"/>
<input type="text" name="name"/>
<input type="text" name="name"/>
<input type="text" name="name"/>
<input type="text" name="name"/>
<input type="text" name="name"/>
<p>
id=myid
<input type="text" name="age" id="myid"/>
<input type="text" name="age"/>
<input type="text" name="age"/>
<p>
	textarea
	<textarea></textarea>
	<textarea></textarea>
	<textarea></textarea>
	
</p>

	<p name="txt">안녕</p>
	<div name="txt">Hello</div>
	<p name="txt">홍길동</p>
	
	<input type="button" onclick="findByName()" value="findByName"/>
	<input type="button" onclick="findById()" value="findById"/>
	<input type="button"onclick="findByTagName()" value="findByTagName"/>
	<input type="button" onclick="findByName2()" value="findByName2"/>
<script type="text/javascript" charset="utf-8">
function findByName2 () {
  var tags = document.getElementsByName("txt");
  for(var i=0; i<tags.length;i++){
  	tags[i].style.color="red";
  	tags[i].style.fontWeight="bold";
  }
}
function findByTagName () {
  var tags = document.getElementsByTagName("textArea");
  for(var i =0; i<tags.length; i++){
  	tags[i].rows=5;
  	tags[i].colos = 20;
  	tags[i].value = "이것은 TA입니다.";
  }
}

function findById () {
  var tag = document.getElementById("myid");
  tag.value="내 나이는 30살 입니다.";
}
	function findByName(){
		var tags = document.getElementsByName("name");//Node List(배열)
		for(var i =0; i<tags.length; i++){
			tags[i].value="Hello";
		}
	}
</script>
</body>
</html>